package cn.mesmile.code.support;

import cn.hutool.core.bean.BeanUtil;

import java.util.Objects;

/**
 * 包装类,返回视图层所需的字段
 */
public class NoticeWrapper extends BaseEntityWrapper<Notice, NoticeVO> {

	public static NoticeWrapper build() {
		return new NoticeWrapper();
	}

	@Override
	public NoticeVO entityVO(Notice notice) {
        NoticeVO noticeVO = Objects.requireNonNull(BeanUtil.copyProperties(notice, NoticeVO.class));
        Integer gender = notice.getGender();
        if (gender == null){
            noticeVO.setGenderName("未知");
        } else if (gender == 1){
            noticeVO.setGenderName("男");
        } else if (gender == 0){
            noticeVO.setGenderName("女");
        } else {
            noticeVO.setGenderName("未知");
        }
//		String dictValue = DictCache.getValue(DictEnum.NOTICE, noticeVO.getCategory());
//		noticeVO.setCategoryName(dictValue);
		return noticeVO;
	}

}